home *** CD-ROM | disk | FTP | other *** search
- /* TimeG.c
- * 28.5.1992 (c) by Thomas Göcke, inspiration by ThoF
- *
- * TimeG ist identisch mit "Time".
- *
- * Ausnahme:
- * Die Anzeige der Zeit erfolgt mit Ziffern des Fonts Garnet. Dieser muß
- * sich im Verzeichnis "fonts:" befinden (eventl. von der Extras1.3
- * Diskette kopieren).
- *
- * So kommt ein wenig Abwechslung auf die nüchterne Workbench
- *
- *
- * Compiler: DICE 2.06.40 (auch als PD / Shareware erhältlich)
- *
- * Compile Instr.:
- * dcc TimeG.c -1.3 -o RAM:Time -E RAM:ErrorList -v
- *
- * Aufruf: Run TimeG
- */
-
- #include <exec/types.h>
- #include <intuition/intuitionbase.h>
- #include <intuition/intuition.h>
- #include <time.h>
- #include <libraries/dos.h>
-
- struct IntuiMessage *message;
- struct RastPort *rp;
- struct Window *win;
- struct NewWindow nwindow =
- {
- 517, 1, 70, 8, 1, 1,
- CLOSEWINDOW, WINDOWCLOSE | WINDOWDRAG,
- NULL, NULL, "", NULL, NULL, NULL, NULL, NULL, NULL,
- WBENCHSCREEN
- };
- struct TextFont *txtfnt; /* Zeiger auf TextFont Struktur */
- struct TextAttr txtatt; /* " " TextAttr " */
-
-
- void
- CloseAll ()
- {
- if (win) CloseWindow (win);
- if (txtfnt != 0) CloseFont (txtfnt); /* spart Speicher */
- exit (0);
- }
-
- main()
- {
- char buff[9];
- ULONG MessageClass;
- USHORT code;
-
- if (!(win = (struct Window *) OpenWindow (&nwindow))) CloseAll ();
- rp = win->RPort; /* Rastport des geöffneten Windows ermittelm */
- SetAPen (rp, 0); /* Farbe d. Ziffern = Hintergrundfarbe d. Workbench */
- SetBPen (rp, 1); /* Hintergrundfarbe = Vordergrundfarbe d. Workbench */
- txtatt.ta_Name = "garnet.font"; /* TextAttr-Struktur füllen */
- txtatt.ta_YSize = 9; /* 9-Punkte */
- txtatt.ta_Style = 0; /* normale Darstellung */
- txtatt.ta_Flags = 0;
- txtfnt = (struct TextFont *) OpenDiskFont (&txtatt);
- if (txtfnt != 0) SetFont (rp, txtfnt);
- while (1)
- {
- time_t t=time(NULL);
- struct tm *tp = localtime (&t);
- sprintf (buff, "%02d:%02d:%02d ", tp->tm_hour, tp->tm_min, tp->tm_sec);
- Move (rp, 0, 7);
- Text (rp, buff, 9);
- Delay (50);
- WindowToFront (win);
- if (message = (struct IntuiMessage *) GetMsg(win->UserPort))
- {
- MessageClass = message->Class;
- code = message->Code;
- ReplyMsg (message);
- if (MessageClass == CLOSEWINDOW) CloseAll ();
- }
- }
- }
-
-